using UnityEngine;
using System.Collections;

public class CreditsMenu : MenuModel
{

    private HUDButton _btnBack;

    void Start()
    {
        AffectButtons();
    }

    //Get Buttons
    void AffectButtons()
    {
        foreach (HUDButton button in _listButtons)
        {

            if (button.name == "backButton")
            {
                _btnBack = button;
            }
        }

        foreach (Transform txtTransform in _listTexts)
        {
            string text = TextManager.Instance().GetText(txtTransform.name);
            TextMesh txt = txtTransform.GetComponent<TextMesh>();

            txt.text = text;
            txt.anchor = TextAnchor.MiddleCenter;

        }
    }

    public override void OnRelease(object o)
    {

        //Check release button
        foreach (HUDButton button in _listButtons)
        {
            if (button == o)
            {
                if (button == _btnBack)
                    SwitchSceneManager.Instance.SwitchToScene("MenuPrincipal");

            }
        }

    }

}
